'use strict';

const Controller = require('egg').Controller;
// const fs = require('fs');
// const path = require('path');
class IndexController extends Controller {
  async getHtml() {

    const { ctx } = this;
    const data = { name: 'egg' };
    await ctx.render('home.nj', { data })

    console.log('ctx.body', ctx.body)

    // 手动生成html
    // const file = path.resolve(app.config.static.dir, 'index.html');
    // ctx.set('Content-Type', 'text/html');
    // ctx.body = await fs.readFileSync(file);
  }
}

module.exports = IndexController;
